package com.andrew.dao;

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import com.andrew.entity.Customer;
import com.andrew.entity.Order;
import com.andrew.entity.OrderBeanForAdmin;
import com.andrew.entity.OrderDetail;
import com.andrew.entity.OrderDetailForAdmin;

public interface OrderDao {
	/**
	 * 添加订单
	 * @param order
	 * @throws SQLException
	 */
	public abstract void addOrder(Order order,Connection conn) throws SQLException;
	
	/**
	 * 批量添加订单详情
	 * @param orderDetailsList
	 * @throws SQLException
	 */
	public abstract void addOrderDetailList(List<OrderDetail> orderDetailsList,Connection conn) throws SQLException;

	/**
	 * 获取当前用户的订单详情
	 * @param customer
	 * @return
	 * @throws SQLException
	 */
	public abstract List<Order> getOrderByCustomerId(Customer customer) throws SQLException;
	
	/**
	 * 获取全部订单信息
	 * @return
	 * @throws SQLException
	 */
	public abstract List<Order> getAllOrders() throws SQLException;
	
	/**
	 * 根据订单号获取单个订单信息
	 * @param orderNum
	 * @return
	 * @throws SQLException
	 */
	public abstract Order getOrdersByOrderId(String orderId) throws SQLException;
	
	/***
	 * 修改orders表中的状态：-1:未付款 0:付款成功，未发货 1.付款成功，已发货  2.已收货
	 * @param bookId
	 * @param status
	 * @return
	 * @throws SQLException
	 */
	public int updateOrderStatus(String orderId,int status)throws SQLException;
	
	
	/**
	 * 设置订单收货地址
	 * @param address
	 * @throws SQLException
	 */
	public abstract void setAddress(String orderId,String address)throws SQLException;

	/**
	 * 删除一个订单详情
	 * @param orderId
	 * @param bookId
	 */
	public abstract int deleteOrderDetail(String orderId, int bookId,Connection con) throws SQLException;
	
	/**
	 * 更新订单总价格
	 * @param orderId
	 * @param price
	 * @return
	 * @throws SQLException
	 */
	public abstract int updateOrderPrice(String orderId,Connection con) throws SQLException;
	
	/**
	 * 删除的单个订单
	 * @param OrderId
	 * @return
	 * @throws SQLException
	 */
	public abstract int deleteOrderByOrderId(String OrderId,Connection con) throws SQLException;

	/**
	 * 更新订单详情的数量
	 * @param orderId
	 * @param bookId
	 * @param newQuantity
	 * @param con
	 */
	public abstract void updateOrderDetailQuantityAndsubTotail(String orderId, int bookId, int newQuantity, Connection con) throws SQLException;

	/**
	 * 更新订单详情状态
	 * @param orderId
	 * @param bookId
	 * @throws SQLException
	 */
	public abstract void updateOrderDetailStatus(int orderDetailId) throws SQLException;
	
	/**
	 * 获取单个订单详情
	 * @param orderDetailId
	 * @return
	 * @throws SQLException
	 */
	public abstract OrderDetail getOrderDetailByOrderDetailId(int orderDetailId) throws SQLException;
}
